package com.xy.biz.mc.service;

import com.xy.biz.mc.connection.SocketConnection;

/**
 * 终端连接服务
 */
public interface ConnectionService {

    /**
     * 注册终端连接
     *
     * @param userId
     * @param userGroupId
     * @param connection
     */
    void addConnection(Long userId, Long userGroupId, SocketConnection connection);

    /**
     * 注销终端连接
     *
     * @param userId
     * @param userGroupId
     * @param connection
     */
    void removeConnection(Long userId, Long userGroupId, SocketConnection connection);

    /**
     * 获取终端连接
     *
     * @param userId
     * @return
     */
    SocketConnection getConnection(Long userId);

    /**
     * 清除不活跃的连接
     */
    void purgeDeadConnection();

}
